{include file="header.html"}

<script src="templates/jsnew/MediaStreamRecorder.js"> </script>
<script src="http://api.map.baidu.com/api?v=2.0&ak=kkA94xvGPjnprY92WU4yYME8"></script>

<script type="text/javascript">


$(function(){
	$("[id^='h_type_']").live("change",function(){
		var type = $(this).val();
		if(type==1){
			$(this).parent().parent().find('.range').hide();
		}else{
			$(this).parent().parent().find('.range').show();
		}
	});
    $('#paiche_form').validate({
        errorPlacement: function(error, element){
            //$(element).next('.noerror').hide();          
            //$(element).after(error);
        },
        success       : function(element){
        	 $(element).next('.noerror').show();  
        	 $(element).remove();
        },
        rules : {    
        	operator : {
                required : true
            },
            wm_vhc_code :{
                required : true
            },
            wm_driver :{
            	required : true
            },
            wm_driver_tel :{
                required : true
            }
        },
        messages : {
        	operator : {
                required : '承运商必填'
            },
            wm_vhc_code : {
                required : '车牌号必填'
            },
            wm_driver : {
                required : '司机必填'
            },
            wm_driver_tel : {
                required : '司机电话必填'
            }
        }
    });

    
    $("[id^='hzshowa_']").live('click',function(){
		var id=$(this).attr("item");
		$w=$(window).width();
        $h=$(window).height();
        $w=$w*0.7;
        $("#hzframe").attr("src","index.php?app=datarefer&act=choosehz"+"&hzid="+id);
    	$("#hzframe").width($w);
        $.colorbox({
            width : $w+20,
            height : "650px",
            inline : true,
            href : "#hzlist"
        });
	});
    
    {if $cannew}
    $('#g_packingtime').datetimepicker({changeMonth: true,changeYear: true});
    $('#g_collectiontime').datetimepicker({changeMonth: true,changeYear: true});
    {/if}
    
    $("#yinru").click(function(){
    	  $w=$(window).width();
          $h=$(window).height();
          $w=$w*0.7;
          $("#tagframe").attr("src","index.php?app=waybillless&act=choosegoods&t="+$("#wm_type").val()+"&code="+$("#wm_code").val()+"&wmid="+$("#wm_tid").val());
      	  $("#tagframe").width($w);
          $.colorbox({
              width : $w+20,
              height : "650px",
              inline : true,
              href : "#taglist"
          });
    });
    
    $("#wm_vhc_code").click(function(){
    	  $w=$(window).width();
          $h=$(window).height();
          $w=$w*0.7;
          $("#pcframe").attr("src","index.php?app=waybill&act=choose&wid="+$("#wm_tid").val()+"&oper="+$("#operator").val());
      	$("#pcframe").width($w);
          $.colorbox({
              width : $w+20,
              height : "650px",
              inline : true,
              href : "#pclist"
          });
  	});
    
    
    $("#cimg").click(function(){
  	  $w=$(window).width();
        $h=$(window).height();
        $w=$w*0.7;
        $("#pcframe").attr("src","index.php?app=waybill&act=choose&wid="+$("#wm_tid").val()+"&oper="+$("#operator").val());
    	$("#pcframe").width($w);
        $.colorbox({
            width : $w+20,
            height : "650px",
            inline : true,
            href : "#pclist"
        });
	});
    
    
    
    $("#operatorshowa").click(function(){
  	  $w=$(window).width();
        $h=$(window).height();
        $w=$w*0.7;
        $("#opframe").attr("src","index.php?app=datarefer&act=chooseop&wid="+$("#wm_tid").val());
    	$("#opframe").width($w);
        $.colorbox({
            width : $w+20,
            height : "650px",
            inline : true,
            href : "#oplist"
        });
	});
	//调用添加采集信息点击事件
	$(".addhandle2").on("click",addhandle);
   /* $("#trans").click(function(){
    	  $w=$(window).width();
          $h=$(window).height();
          $w=$w*0.7;
          $("#transframe").attr("src","index.php?app=waybillless&act=trans&wid="+$("#wm_tid").val());
      	$("#transframe").width($w);
          $.colorbox({
              width : $w+20,
              height : "650px",
              inline : true,
              href : "#translist"
          });
  	});*/
    
});
function huozhu(textid,tel,valueid){
	var v=$("#"+textid).val();
	var urlval=$("#"+textid).attr("urlval");
	if(v!=""&&v!=null){
		$.ajax({
			type: "GET",
			url: urlval,
			data: {q:v},
			dataType: "json",
			success: function(data){
				if(!data.done){
					$("#"+valueid).val(0);
					$("#"+textid).val("");
					$("#"+tel).val("");
				}else{
					$("#"+valueid).val(data.retval.id);
					$("#"+textid).val(data.retval.text);
					$("#"+tel).val(data.retval.o_linktel);
				}
			}
		});
	}else{
		$("#"+valueid).val(0);
		$("#"+textid).val("");
		$("#"+tel).val("");
	}
}

function gethz(textid,tel,valueid){
	var url=$("#"+textid).attr("urldata");
	var urlval=$("#"+textid).attr("urlval");
	if(url==undefined||url==null||url==""||urlval==undefined||urlval==null||urlval==""){
		return;
	}
	AutoComplete({
		EmptyMessage: "没有数据",
		Url: url,
		_Select: function(item) {
			$("#"+textid).unbind("blur");
			$("#"+textid).val($(item).text());
			var attr = $(item).attr("data-autocomplete-value");
			var arr = attr.split(';');
			$("#"+valueid).val(arr[0]);
			$("#"+tel).val(arr[2]);
			if(valueid!=undefined&&valueid!=""&&valueid!=null){
				$("#"+valueid).val(arr[0]);
			}
			$("#"+textid).bind('blur',function(){
				huozhu(textid,tel,valueid);
			});
		}
	}, "#"+textid);
}

var mediaRecorder={};
function onMediaSuccess(stream) {
    mediaRecorder = new MediaStreamRecorder(stream);
    mediaRecorder.mimeType = 'audio/ogg';
    mediaRecorder.audioChannels = 1;
    mediaRecorder.ondataavailable = function (blob) {
        
    	var fileType = 'video'; // or "audio"
		var fileName = 'wm_requiredl_note_voice.ogg';  // or "wav" or "ogg"

		var formData = new FormData();
		formData.append(fileType + '-filename', fileName);
		formData.append(fileType + '-blob', blob);

		xhr('index.php?app=upload', formData, function (fileURL) {
		    window.open(fileURL);
		});

		function xhr(url, data, callback) {
		    var request = new XMLHttpRequest();
		    request.onreadystatechange = function () {
		        if (request.readyState == 4 && request.status == 200) {
		            //callback(location.href + request.responseText);
		            $("#wm_requiredl_note_voice").val(request.responseText);
		        }
		    };
		    request.open('POST', url);
		    request.send(data);
		}
    };
    mediaRecorder.start(10*60*1000);
}
function changeop(id,name){
	$('opframe').colorbox.close();
	$("#operator").val(id);
	$("#operatorshow").val(name);
}

function cargotimeimg (type,number,id){
	
	if(type==1){
		if(number==1){
			$('#g_loading_date_'+id).focus();
		}else if(number==2){
			$('#g_unloading_date_'+id).focus();
		}else if (number==3){
			$('#g_tgdate_'+id).focus();
		}else if(number==4){
			$('#g_rdate_'+id).focus();
		}
	}else if(type==3){
		
		$('#h_required_service_date_'+id).focus();
	}
}


function changehz(id,name,hzid,linkman,linktel){
	$.colorbox.close();
	$("#g_ownertid_"+hzid).val(id);
	$("#hzshow_"+hzid).val(name);
	$("#g_owner_tel_"+hzid).val(linktel);

    $("#hzshow_"+hzid).focus();
	$("#g_owner_tel_"+hzid).focus();
}
function onMediaError(e) {
    console.error('media error', e);
}

function start(){
	$("#stopbtn").show();
	$("#startbtn").hide();
	var mediaConstraints = {audio: true};
	navigator.getUserMedia(mediaConstraints, onMediaSuccess, onMediaError);
}

function stop(){
	if(typeof mediaRecorder.stop=='function'){
		mediaRecorder.stop();
		$("#stopbtn").hide();
		$("#startbtn").show();
	}
}


var l=10000;

var mainid=0;
var mapsender=null;
var tag;
var maptype;
var newline;
	//地图选择

	function mapselect(mapid,id,sender,type,line){
	
		newline=line;
		mainid=id;
		mapsender=sender;
		tag=mainid;
		maptype=type;
		$w=$(window).width();
		$h=$(window).height();
		$w=$w*0.7;
		
	
        if(maptype==1){
        	$("#mapframe").attr("src","index.php?app=map&act=mapselect&lng="+parseFloat($("[id='g_unloading_lng_"+mainid+"']").val())+"&lat="+parseFloat($("[id='g_unloading_lat_"+mainid+"']").val())+"&ret=window.parent.mapresult&address="+$("[id='g_loading_place_"+mainid+"']").val());
		}
		else if (maptype==2){
			$("#mapframe").attr("src","index.php?app=map&act=mapselect&lng="+parseFloat($("[id='g_loading_lng_"+mainid+"']").val())+"&lat="+parseFloat($("[id='g_loading_lat_"+mainid+"']").val())+"&ret=window.parent.mapresult&address="+$("[id='g_unloading_place_"+mainid+"']").val());
	
		}else if (newline==3){
			$("#mapframe").attr("src","index.php?app=map&act=mapselect&lng="+parseFloat($("[id='h_lat_"+mainid+"']").val())+"&lat="+parseFloat($("[id='h_lng_"+mainid+"']").val())+"&ret=window.parent.mapresult&address="+$("[id='haul_"+mainid+"_h_address']").val());
			
			
		}
		$("#mapframe").width($w);
		$.colorbox({
			width : $w+20,
			height : "650px",
			inline : true,
			href : "#maplist"
		});
	}
	
	function mapresult(lng,lat,addr){
		$('mapframe').colorbox.close();
	
		if(maptype==1){
			$("#g_unloading_lng_"+tag+"").val(lng);
			$("#g_unloading_lat_"+tag+"").val(lat);
			$("#g_loading_place_"+tag+"").val(addr);
			
			
		}
		else if (maptype==2){

			$("#g_loading_lng_"+tag+"").val(lng);
			$("#g_loading_lat_"+tag+"").val(lat);
			$("#g_unloading_place_"+tag+"").val(addr);
			
		}
		else if (newline==3){
			$("#h_lat_"+tag+"").val(lng);
			$("#h_lng_"+tag+"").val(lat);
			$("#haul_"+tag+"_h_address").val(addr);

		}

		
		
		
		if(mapsender!=null){
			$(mapsender).html()
		}
		
		
		
		if($("#g_unloading_lng_"+tag+"").val()>0&&$("#g_unloading_lng_"+tag+"").val()>0){
			$("#mapimg_"+tag+"").attr("src","templates/images/newadmin/map1.png");
		}
		if($("#g_loading_lat_"+tag+"").val()>0&&$("#g_loading_lng_"+tag+"").val()>0){
			$("#unmapimg_"+tag+"").attr("src","templates/images/newadmin/map1.png");
		}

		if($("#h_lat_"+tag+"").val()>0&&$("#h_lng_"+tag+"").val()>0){
			$("#hmapimg_"+tag+"").attr("src","templates/images/newadmin/map1.png");
		}
	}

</script>




<style>
.infoTable{
margin: 0 0 0 0;
}
.info th {
    text-align: right;
    
}
#form11 th,#form1 th{
text-align: right;
    padding-right: 15px;
}
.infoTableInput,.infoTable select{
	width: 100%;
}
.grayb{background: #eee;}
.info td a{color: #1874CD}
.itemdiv .querySelect{height: 23px;
   width:200px;
    border: 1px solid #ccc;
    outline: 0;
    font-size: 14px;
    line-height: 19px;
    box-sizing: border-box;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;}
    .itemdiv .infoTableInput{height: 23px;
   width:300px;
    padding: 0 5px;
    border: 1px solid #ccc;
    outline: 0;
    font-size: 14px;
    line-height: 19px;
    box-sizing: border-box;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;}
a.btn_add,.rmlink{
	display: inline-block !important;
	height: 23px;
	margin: 5px;
	padding: 0 10px;
	border: 1px solid #ddd;
	border-radius: 4px;
	outline: 0;
	background-image: none;
	background-color: #fff;
	font-size: 12px;
	font-weight: 400;
	line-height: 23px;
	color: #1a1a1a;
	text-align: center;
	vertical-align: top;
	white-space: nowrap;
	cursor: pointer;
	user-select: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	box-sizing: border-box;
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
	-o-box-sizing: border-box;
	background-color: #0ae;
	border-color: #0ae;
	color: #fff;
	text-shadow: none;
}
.haul_div{
	border-left: 4px solid #76b5ea;
	border-top: 1px solid #d3dae0;
	border-bottom: 1px solid #d3dae0;
	border-right: 1px solid #d3dae0;
	margin: 10px 10px 0 20px;
}
</style>


<div id="rightTop">
	<p>{$lang.waybill_less} <lable id="typeshow" style="font-weight: bold;">[{$waybill.wm_type}]</lable> {$waybill.wm_code} [{$waybill.wm_stauts}]</p>
	<ul class="subnav">
		<li><a class="btn1" href="index.php?app=waybillless">{$lang.manage}</a>
		</li>
		<!-- {if $waybill.wm_tid}} -->
		<li>
			<a class="btn1" href="index.php?app=waybillless&amp;act=add">{$lang.add}</a>
		</li>
		<li>
			<span>编辑</span></li>
		<!-- {else} -->
		<li>
			<span>新建</span>
		</li><!-- {/if} -->
	</ul>
</div>
<div style="display: none"  >
	<div id="pclist">
	<iframe id="pcframe" src="index.php?app=waybillless&act=choose&wid={$waybill.wm_tid}" width="" height="600px" frameborder="0" scrolling="no"></iframe>
	</div>
</div>
<div style="display: none"  >
	<div id="taglist">
	<iframe id="tagframe" src="index.php?app=waybillless&act=choosegoods" width="" height="600px" frameborder="0" scrolling="no"></iframe>
	</div>
</div>
<div style="display: none"  >
	<div id="oplist">
	<iframe id="opframe" width="" height="600px" frameborder="0" scrolling="no"></iframe>
	</div>
</div>
<div style="display: none"  >
	<div id="hzlist">
	<iframe id="hzframe" width="" height="600px" frameborder="0" scrolling="no"></iframe>
	</div>
</div>
<div style="display: none"  >
	<div id="maplist">
		<iframe id="mapframe" width="" height="600px" frameborder="0" scrolling="no"></iframe>
	</div>
</div>
<div style="display: none"  >
	<div id="translist">
		<iframe id="transframe" width="" height="600px" frameborder="0" scrolling="no"></iframe>
	</div>
</div>
<div style="display: none"  >
	<div id="monitorlist">
		<iframe id="monitorframe" width="" height="600px" frameborder="0" scrolling="no"></iframe>
	</div>
</div>
<div class="info">
	{if $canedit}<div class="infoTable" style="padding-left: 10px;padding-top: 20px">
		<input class="formbtn" type="button" id="yinru" value="引入货物">
		<input class="formbtn" type="button" id="addhz" value="添加货单">
	</div>
{/if}

<script>

function formsub(){
	var f=true;
	$("[id^='gs_name_']").each(function(){
		if($(this).val()==""&&$(this).attr("item")>=0){
			f=false;
			$(this).addClass("error");
		}
	});
	
	$("[id^='gs_piece_']").each(function(){
		if($(this).val()==""&&$(this).attr("item")>=0){
			f=false;
			$(this).addClass("error");
		}
	});
	
	$("[id^='gs_weight_']").each(function(){
		if($(this).val()==""&&$(this).attr("item")>=0){
			f=false;
			$(this).addClass("error");
		}
	});
	
	$("[id^='gs_size_']").each(function(){
		if($(this).val()==""&&$(this).attr("item")>=0){
			f=false;
			$(this).addClass("error");
		}
	});
	
	
	
	
	$("[id^='hzshow_']").each(function(){
		if($(this).val()==""&&$(this).attr("item")>=0){
			f=false;
			$(this).addClass("error");
		}
	});
	
	$("[id^='g_owner_tel_']").each(function(){
		if($(this).val()==""&&$(this).attr("item")>=0){
			f=false;
			$(this).addClass("error");
		}
	});
	
	$("[id^='g_loading_place_']").each(function(){
		if($(this).val()==""&&$(this).attr("item")>=0){
			f=false;
			$(this).addClass("error");
		}
	});
	
	$("[id^='g_unloading_place_']").each(function(){
		if($(this).val()==""&&$(this).attr("item")>=0){
			f=false;
			$(this).addClass("error");
		}
	});
	
	$("[id^='g_loading_date_']").each(function(){
		if($(this).val()==""&&$(this).attr("item")>=0){
			f=false;
			$(this).addClass("error");
		}
	});
	
	$("[id^='g_unloading_date_']").each(function(){
		if($(this).val()==""&&$(this).attr("item")>=0){
			f=false;
			$(this).addClass("error");
		}
	});
	
	$("[id^='g_consignee_']").each(function(){
		if($(this).val()==""&&$(this).attr("item")>=0){
			f=false;
			$(this).addClass("error");
		}
	});
	
	$("[id^='g_consignee_tel_']").each(function(){
		if($(this).val()==""&&$(this).attr("item")>=0){
			f=false;
			$(this).addClass("error");
		}
	});
	
	$("[id^='g_consignor_']").each(function(){
		if($(this).val()==""&&$(this).attr("item")>=0){
			f=false;
			$(this).addClass("error");
		}
	});
	
	$("[id^='g_consignor_tel_']").each(function(){
		if($(this).val()==""&&$(this).attr("item")>=0){
			f=false;
			$(this).addClass("error");
		}
	});
	
	$("[id^='g_tgdate_']").each(function(){
		if($(this).val()==""&&$(this).attr("item")>=0){
			f=false;
			$(this).addClass("error");
		}
	});

	if(!f){
		return false;
	}
	
	$("#acategory_form").submit();
}
var f=100000;
var i=1000000;
function addhaul(){
	var t=$("#templete_haul").html();
	f++;
	i++;
	t=t.replace(/{num}/g,f).replace(/{fig}/g,i);
	$("#div_haul").append(t);
	//给模版绑定事件
	$(".addhandle2:last").on("click",addhandle);
}
function addhandle(){
	var th=$("#templete_handle").html();
	i++;
	var oldValue=parseInt($(this).attr('dig'));//取出现在的值，并使用parseInt转为int类型数据
	oldValue++;//自加1
	$(this).attr('dig',oldValue);
	var haul_num = $(this).attr('var');
	th=th.replace(/{num}/g,haul_num).replace(/{fig}/g,i).replace(/{c}/g,oldValue);
	$(this).parents(".itemdiv").append(th);

}
$(function(){
	var l=10000;
	var lsub=10000;
	$("#addhz").click(function(){
		var t=$("#templete").html();
		l++;
		t=t.replace(/{line}/g,l);
		t=t.replace(/{linesub}/g,0);
		$("#acategory_form").append(t);
		$('#g_tgdate_'+l).datetimepicker({changeMonth: true,changeYear: true});
		$('#g_rdate_'+l).datetimepicker({changeMonth: true,changeYear: true});
		$('#g_loading_date_'+l).datetimepicker({changeMonth: true,changeYear: true});
		$('#g_unloading_date_'+l).datetimepicker({changeMonth: true,changeYear: true});
		gethz("hzshow_"+l,"g_owner_tel_"+l,"g_ownertid_"+l);
	});
	
	$("[id^='add_']").live("click",function(){
		var i=$(this).attr("item");
		
		var t=$("#templetesub").html();
		lsub++;
		t=t.replace(/{line}/g,i);
		t=t.replace(/{linesub}/g,lsub);
		$("#sub_"+i).append(t);
	});
	
	$("[id^='del_']").live('click',function(){
		var i=$(this).attr("item");
		var t=$(this);
		if(confirm("是否要删除此货单?")){
			if(i>0){
				 $.ajax({
		             type: "post",
		             url: "index.php?app=waybillless&act=del",
		             data: {id:i,wid:$("#wm_tid").val()},
		             dataType: "json",
		             success: function(data){
		                        if(data.done){
		                        	t.parent().parent().next().remove();
		            				t.parent().parent().next().remove();
		            				t.parent().parent().next().remove();
		                        	t.parent().parent().remove();
		                        }else{
		                        	alert(data.msg);
		                        }
		                      }
		         });
			}else{

				$(this).parent().parent().next().remove();
				$(this).parent().parent().next().remove();
				$(this).parent().parent().next().remove();
				$(this).parent().parent().remove();
			}
		}
	});
	
	$("[id^='gs_name_']").live('focus',function(){
		$(this).removeClass("error");
	});
	$("[id^='gs_piece_']").live('focus',function(){
		$(this).removeClass("error");
	});
	
	$("[id^='gs_weight_']").live('focus',function(){
		$(this).removeClass("error");
	});
	
	$("[id^='gs_size_']").live('focus',function(){
		$(this).removeClass("error");
	});
	
	$("[id^='hzshow_']").live('focus',function(){
		$(this).removeClass("error");
	});
	
	$("[id^='g_owner_tel_']").live('focus',function(){
		$(this).removeClass("error");
	});
	
	$("[id^='g_loading_place_']").live('focus',function(){
		$(this).removeClass("error");
	});
	
	$("[id^='g_unloading_place_']").live('focus',function(){
		$(this).removeClass("error");
	});
	
	$("[id^='g_loading_date_']").live('focus',function(){
		$(this).removeClass("error");
	});
	
	$("[id^='g_unloading_date_']").live('focus',function(){
		$(this).removeClass("error");
	});
	
	$("[id^='g_consignee_']").live('focus',function(){
		$(this).removeClass("error");
	});
	
	$("[id^='g_consignee_tel_']").live('focus',function(){
		$(this).removeClass("error");
	});
	
	$("[id^='g_consignor_']").live('focus',function(){
		$(this).removeClass("error");
	});
	
	$("[id^='g_consignor_tel_']").live('focus',function(){
		$(this).removeClass("error");
	});
	
	$("[id^='g_tgdate_']").live('focus',function(){
		$(this).removeClass("error");
	});
	$("[id^='subdel_']").live('click',function(){
		var i=$(this).attr("item");
		var p=$(this).attr("p");
		var t=$(this);
		if(confirm("是否要删除此行?")){
			if(i>0){
				 $.ajax({
		             type: "post",
		             url: "index.php?app=waybillless&act=delsub",
		             data: {id:i},
		             dataType: "json",
		             success: function(data){
		                        if(data.done){
		                        	t.parent().parent().remove();

		                        	if($("#sub_"+p).find("tr").length==0){
		            					$("#add_"+p).click();
		            				}
		                        }else{
		                        	alert(data.msg);
		                        }
		                      }
		         });
			}else{
				$(this).parent().parent().remove();

				if($("#sub_"+p).find("tr").length==0){
					$("#add_"+p).click();
				}
			}
		}
	});
	
	$("#wm_zmmtid").change(function(){
		//ajax处理
		var id = $("#wm_tid").val();
		var mid = $(this).val();
		if(mid==''){
			alert('请选择监控方案');
			return false;
		}
		$.ajax({
			type: "post",
			url: "index.php?app=waybillless&act=monitor",
			data: {id:id,mid:mid},
			dataType: "json",
			success: function(data){
				if(data.done){
					//成功的提示
					$("#syss").text(data.msg);
					$("#syss").slideDown();
					setTimeout(function(){
						$("#syss").slideUp();
					},2000);
				}else{
					alert(data.msg);
				}
			}
		});
		//window.location.href="index.php?app=waybillless&act=monitor&id="+$("#wm_tid").val()+"&mid="+$(this).val();
	});
	
	$("#yuncheng").change(function(){
		if(confirm("确认删除现运程,引入新方案吗?")){
			window.location.href="index.php?app=waybillless&act=hauldefine&id="+$("#wm_tid").val()+"&hid="+$(this).val();
		}
	});
});
//监控方案详情
function monitorinfo(mid){
	var wm_zmmtid = $("#wm_zmmtid").val();
	if(wm_zmmtid=='' || wm_zmmtid==0){
		alert('请先选择监控方案，再查看详情');
		return false;
	}
	$w=$(window).width();
	$h=$(window).height();
	$w=$w*0.7;
	$("#monitorframe").attr("src","index.php?app=waybill&act=monitorinfo&mid="+wm_zmmtid);
	$("#monitorframe").width($w);
	$.colorbox({
		width : $w+20,
		height : "650px",
		inline : true,
		href : "#monitorlist"
	});
}
</script>
	<div id="templete_haul" style="display: none">
		<div class = "haul_div">
			<table class="infoTable tt" style="width:98%;padding: 10px 0 0 0">
				<tr>
					<th class="paddingT15">运程:</th>
					<td class="paddingT15 wordSpacing5">
						<input class="infoTableInput" type="text" name="haul[{num}][h_name]" value="" />
						<input type="hidden" name="haul[{num}][h_tid]" value="" />
					</td>
					<th class="paddingT15">联系人: </th>
					<td class="paddingT15 wordSpacing5">
						<input 	class="infoTableInput" type="text" name="haul[{num}][h_linkman]" value=""  />
					</td>
					<th class="paddingT15">电话:</th>
					<td class="paddingT15 wordSpacing5">
						<input 	class="infoTableInput" type="text" name="haul[{num}][h_linkman_tel]" value="" />
					</td>
					<th class="paddingT15">确认类型:</th>
					<td class="paddingT15 wordSpacing5 ">
						<select class="querySelect" name="haul[{num}][h_type]" id="h_type_{num}">
							{html_options options=$typelist selected=$h.h_type}
						</select>
					</td>
					<th class="paddingT15 range" >运程范围:</th>
					<td class="paddingT15 wordSpacing5 range">
						<input class="infoTableInput" placeholder="请填写数字" type="text" name="haul[{num}][h_range]" value="" />
					</td>
				</tr>
				<tr>
					<th class="paddingT15">状态:</th>
					<td class="paddingT15 wordSpacing5" style="font-size: 14px">
						未开始
					</td>
					<th class="paddingT15">时间:</th>
					<td class="paddingT15 wordSpacing5" >
						<input 	class="infoTableInput" type="text" name="haul[{num}][h_required_service_date]"
								  value="-" id="h_required_service_date_{num}" />
						<script>
							$("#h_required_service_date_{num}").datetimepicker({changeMonth: true,changeYear: true});
						</script>
						<a href="javascript:void(0);" onclick="timeimg('3','1',{num});"  class="right_a">
							<img src="templates/images/newadmin/rili.png" alt="">
						</a>
					</td>
					<th class="paddingT15">要求:</th>
					<td class="paddingT15 wordSpacing5" >
						<input 	class="infoTableInput" type="text" name="haul[{num}][h_note]" value=""  />
					</td>
					<th class="paddingT15">地址:</th>
					<td class="paddingT15 wordSpacing5">
						<input type="hidden" value="" name="haul[{num}][h_lat]" id="lat_{num}">
						<input type="hidden" value="" name="haul[{num}][h_lng]" id="lng_{num}">
						<input class="infoTableInput" type="text" name="haul[{num}][h_address]" value="" id="haul_{num}_h_address"  />
						<a href="javascript:void(0);" onclick="mapselect('#haul_{num}_h_address',{num},this);" class="right_a">
							<img src="templates/images/newadmin/map.png" alt="" id="mapimg_{num}">
						</a>
					</td>
				</tr>
			</table>
			<div style="padding: 0 0 0 50px" class="itemdiv">
				<a class="addhandle addhandle2 btn_add" var="{num}" dig=1>采集信息</a>
				<div style="padding: 2px 0;">
					<input type="hidden" name="haul[{num}][item][{fig}][hc_tid]" value="" />
					<span style="background: #ccccce;display: block;padding: 5px 8px;float: left">1</span>
					<p style="float: left;margin: 0 40px">操作：
						<select class="querySelect" name="haul[{num}][item][{fig}][h_collect_type]" >
							{html_options options=$ctype}
						</select>
					</p>
					<p style="float: left;margin: 0 40px">说明：<input class="infoTableInput" type="text" name="haul[{num}][item][{fig}][h_collect_des]" value="" style="float: none"/></p>
					<div style="clear: both"></div>
				</div>
			</div>
		</div>
	</div>
	<div id="templete_handle" style="display: none">
		<div style="padding: 2px 0;">
			<input type="hidden" name="haul[{num}][item][{fig}][hc_tid]" value="" />
			<span style="background: #ccccce;display: block;padding: 5px 8px;float: left">{c}</span>
			<p style="float: left;margin: 0 40px">操作：
				<select class="querySelect" name="haul[{num}][item][{fig}][h_collect_type]" >
					{html_options options=$ctype}
				</select>
			</p>
			<p style="float: left;margin: 0 40px">说明：<input class="infoTableInput" type="text" name="haul[{num}][item][{fig}][h_collect_des]" value="" style="float: none"/></p>
			<div style="clear: both"></div>
		</div>
	</div>
	 <table id="templetesub" style="display: none">
        <tr>
			<th  class="paddingT15"><p class="left_th"><b style="color: #ff0000">*&nbsp;</b>品名: </p>
			</th>
			<td>
			<input type="text" placeholder="品名必填" name="normal[{line}][item][{linesub}][gs_name]" id="gs_name_{line}_{linesub}" item="{linesub}" p="{line}"
            	class="infoTableInput" value="">
            	<input type="hidden" name="normal[{line}][item][{linesub}][gs_tid]" value="0" >			
			</td>
			
            	<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>件数:  </th>
            	<td>
            	<input type="text" placeholder="件数必填" name="normal[{line}][item][{linesub}][gs_piece]" id="gs_piece_{line}_{linesub}" item="{linesub}"  p="{line}"
            	class="infoTableInput" value="1">           	
            	</td>
            	
            	<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>重量/吨:  </th>
            	<td> <input type="text" placeholder="重量必填" name="normal[{line}][item][{linesub}][gs_weight]" id="gs_weight_{line}_{linesub}" item="{linesub}"  p="{line}"
            	class="infoTableInput" value="1">             	
            	</td>
            	
            	<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>尺码/立方米:  </th>
            	<td ><input type="text" placeholder="尺码必填" name="normal[{line}][item][{linesub}][gs_size]" id="gs_size_{line}_{linesub}" item="{linesub}"  p="{line}"
            	class="infoTableInput" value="1">
            	</td>
            	<th class="paddingT15"></th> 
            	<td style="white-space: nowrap;"><a id="subdel_{line}_{linesub}"  item="0"  p="{line}" href="javasciprt:;">删除</a>
            	</td>
        </tr>
        </table>

<div id="templete" style="display: none">
		<input type="hidden" name="normal[{line}][g_tid]" value="0"/>
		<div class="jui-cut-label fn-mt25">
	        <div class="jui-message-bar">货物信息<a style="float: right;margin-right: 20px" item="{line}" id="add_{line}">添加货物</a>　<a style="float: right;margin-right: 20px" item="0" id="del_{line}">删除货单</a></div>
	    </div>
	    <table class="infoTable" style="padding-bottom: 0px" id="sub_{line}">    	
         <tr>
				<th  class="paddingT15"><p class="left_th"><b style="color: #ff0000">*&nbsp;</b>品名: </p>
				</th>
				<td>
				<input type="text" placeholder="品名必填" name="normal[{line}][item][0][gs_name]" id="gs_name_{line}_0" item="{linesub}" p="{line}"
             	class="infoTableInput" value="">
             	<input type="hidden" name="normal[{line}][item][0][gs_tid]" value="0" >			
				</td>
				
             	<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>件数:  </th>
             	<td>
             	<input type="text" placeholder="件数必填" name="normal[{line}][item][0][gs_piece]" id="gs_piece_{line}_0" item="{linesub}"  p="{line}"
             	class="infoTableInput" value="1">           	
             	</td>
             	
             	<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>重量/吨:  </th>
             	<td> <input type="text" placeholder="重量必填" name="normal[{line}][item][0][gs_weight]" id="gs_weight_{line}_0" item="{linesub}"  p="{line}"
             	class="infoTableInput" value="1">             	
             	</td>
             	
             	<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>尺码/立方米:  </th>
             	<td><input type="text" placeholder="尺码必填" name="normal[{line}][item][0][gs_size]" id="gs_size_{line}_0" item="{linesub}"  p="{line}"
             	class="infoTableInput" value="1">
             	</td>
             	<th class="paddingT15"></th> 
             	<td style="white-space: nowrap;">
             	</td>
         </tr>
         </table>
         <hr style="FILTER: alpha(opacity=100,finishopacity=0,style=1)" size="1" width="83%" color="#ccc">
		<table class="infoTable">
			<tr>
				<th  class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>货主: </th>
				<td>
					<input type="hidden" value="{$s.g_ownertid}" name="normal[{line}][g_ownertid]" id="g_ownertid_{line}">
					<input type="text"  placeholder="货主必填" value="" item="{line}" name="normal[{line}][g_owner]" id="hzshow_{line}" class="infoTableInput" urldata="index.php?app=datarefer&act=gethz" urlval="index.php?app=datarefer&act=gethzinfo">
					<a href="javascript:void(0);" class="right_a" item="{line}" id="hzshowa_{line}" ><img src="templates/images/newadmin/serch.png" alt=""></a>
					<script>
						gethz("hzshow_{line}","g_owner_tel_{line}","g_ownertid_{line}");
					</script>
				</td>
             	<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>货主电话:  </th>
             	<td>
             		<input type="text" placeholder="货主电话必填" value="" name="normal[{line}][g_owner_tel]" id="g_owner_tel_{line}"  class="infoTableInput" item="{line}" >
             	</td>
				<th class="paddingT15">货物类型:</th>
				<td class="paddingT15 wordSpacing5">
					<select class="querySelect" name="normal[{line}][g_gtype]" item="{line}">{html_options options=$goodstype }</select>
				</td>
			</tr>
			<tr>
				<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>发货人:</th>
				<td class="paddingT15 wordSpacing5">
					<input placeholder="必填" class="infoTableInput" type="text" name="normal[{line}][g_consignor]" id="g_consignor_{line}" value=""  item="{line}"/>
				</td>
				<th class="paddingT15" id="th_g_collectiontime"><b style="color: #ff0000">*&nbsp;</b>发货人电话:</th>
				<td class="paddingT15 wordSpacing5">
					<input placeholder="必填" class="infoTableInput" type="text" name="normal[{line}][g_consignor_tel]" id="g_consignor_tel_{line}" value="" item="{line}"/>
				</td>
             	<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>装货地:  </th>
             	<td>
					<input type="text" placeholder="装货地必填" value="" name="normal[{line}][g_loading_place]" id="g_loading_place_{line}" class="infoTableInput" item="{line}">
             	
             	<input type="hidden" value="" name="normal[{line}][g_unloading_lat]" id="g_unloading_lat_{line}">
				<input type="hidden" value="" name="normal[{line}][g_unloading_lng]" id="g_unloading_lng_{line}">
				
				<a href="javascript:void(0);" onclick="mapselect('#haul_{line}_h_address',{line},this,'1','1');" class="right_a">
						<img  src="templates/images/newadmin/map.png" alt="" id="mapimg_{line}"></a>
             	</td>
				<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>装货时间:</th>
				<td class="paddingT15 wordSpacing5">
					<input placeholder="必填" class="infoTableInput" type="text"
						   name="normal[{line}][g_loading_date]" id="g_loading_date_{line}" value="" />
					<a href="javascript:void(0);" onclick="cargotimeimg('1','1',{line});" class="right_a"><img src="templates/images/newadmin/rili.png" alt=""></a>
				</td>
         	</tr>
         	<tr>
				<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>收货人:</th>
				<td class="paddingT15 wordSpacing5">
					<input placeholder="必填" class="infoTableInput" type="text" name="normal[{line}][g_consignee]" id="g_consignee_{line}" value=""  item="{line}"/>
				</td>
				<th class="paddingT15" id="th_g_collectiontime"><b style="color: #ff0000">*&nbsp;</b>收货人电话:</th>
				<td class="paddingT15 wordSpacing5">
					<input placeholder="必填" class="infoTableInput" type="text"  name="normal[{line}][g_consignee_tel]" id="g_consignee_tel_{line}" value=""  item="{line}"/>
				</td>
				<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>卸货地:  </th>
				<td>
					<input type="text" placeholder="卸货地必填" value="" name="normal[{line}][g_unloading_place]" id="g_unloading_place_{line}" class="infoTableInput" item="{line}">
					<input type="hidden" value="" name="normal[{line}][g_loading_lat]" id="g_loading_lat_{line}">
					<input type="hidden" value="" name="normal[{line}][g_loading_lng]" id="g_loading_lng_{line}">
					<a href="javascript:void(0);" onclick="mapselect('#haul_{line}_h_address',{line},this,'2','1');" class="right_a">
						<img src="templates/images/newadmin/map.png" alt="" id="unmapimg_{line}"></a>
				</td>
				<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>卸货时间:</th>
				<td class="paddingT15 wordSpacing5">
					<input placeholder="必填" class="infoTableInput" readonly="readonly" type="text" name="normal[{line}][g_unloading_date]" id="g_unloading_date_{line}" value="" />
					<a href="javascript:void(0);" onclick="cargotimeimg('1','2',{line});" class="right_a"><img  src="templates/images/newadmin/rili.png" alt=""></a>
				</td>
         </tr>
		<tr>
			<th class="paddingT15">{$lang.wm_note}:
			</th>
			<td class="paddingT15 wordSpacing5" colspan="8">
				<textarea  name="normal[{line}][g_note]" id="g_note_{line}"  rows="3" style="width: 100%" item="0"></textarea>
			</td>
		</tr>
		</table>	
</div>

       
   
	<form method="post" enctype="multipart/form-data" id="acategory_form">
	<input type="hidden" value="零担" name="wm_type" id="wm_type">
	<input type="hidden" name="wm_code" value="{$waybill.wm_code}" id="wm_code">
	<input type="hidden" value="{if $waybill.wm_tid}{$waybill.wm_tid}{else}0{/if}" name="wm_tid" id="wm_tid">
	
	{foreach from=$sub item=s}
		<input type="hidden" name="normal[{$s.g_tid}][g_tid]" value="{$s.g_tid}"/>
		<div class="jui-cut-label fn-mt25">
	        <div class="jui-message-bar">货物信息{if $canedit&&!$s.new}<a style="float: right;margin-right: 20px" item="{$s.g_tid}" id="add_{$s.g_tid}">添加货物</a>{/if}　{if $canedit&&$s.g_tid>0&&!$s.new}<a style="float: right;margin-right: 20px" item="{$s.g_tid}" id="del_{$s.g_tid}">删除货单</a>{/if}</div>
	    </div>
	    <table class="infoTable" style="padding-bottom: 0px" id="sub_{$s.g_tid}">
	    	{if $s.box}
		 {foreach from=$s.box item=b}
			<tr>
				<th  class="paddingT15"><p class="left_th"><b style="color: #ff0000">*&nbsp;</b>品名: </p>
				</th>
				<td>
				<input type="text" placeholder="品名必填" name="normal[{$s.g_tid}][item][{$b.gs_tid}][gs_name]" id="gs_name_{$s.g_tid}_{$b.gs_tid}" item="{$b.gs_tid}" p="{$s.g_tid}"
             	class="infoTableInput {if ($b.ws_new&&$b.gs_tid>0)||!$canedit}grayb" readonly="readonly"{/if} value="{$b.gs_name}">
             	<input type="hidden" name="normal[{$s.g_tid}][item][{$b.gs_tid}][gs_tid]" value="{$b.gs_tid}" >			
				</td>
				
             	<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>件数:  </th>
             	<td>
             	<input type="text" placeholder="件数必填" name="normal[{$s.g_tid}][item][{$b.gs_tid}][gs_piece]" id="gs_piece_{$s.g_tid}_{$b.gs_tid}" item="{$b.gs_tid}"  p="{$s.g_tid}"
             	class="infoTableInput {if ($b.ws_new&&$b.gs_tid>0)||!$canedit}grayb" readonly="readonly"{/if} value="{$b.ws_piece}">
             	</td>
             	
             	<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>重量/吨:  </th>
             	<td> <input type="text" placeholder="重量必填" name="normal[{$s.g_tid}][item][{$b.gs_tid}][gs_weight]" id="gs_weight_{$s.g_tid}_{$b.gs_tid}" item="{$b.gs_tid}"  p="{$s.g_tid}"
             	class="infoTableInput {if ($b.ws_new&&$b.gs_tid>0)||!$canedit}grayb" readonly="readonly"{/if} value="{$b.ws_weight}">
             	</td>
             	
             	<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>尺码/立方米:  </th>
             	<td><input type="text" placeholder="尺码必填" name="normal[{$s.g_tid}][item][{$b.gs_tid}][gs_size]" id="gs_size_{$s.g_tid}_{$b.gs_tid}" item="{$b.gs_tid}"  p="{$s.g_tid}"
             	class="infoTableInput {if ($b.ws_new&&$b.gs_tid>0)||!$canedit}grayb" readonly="readonly"{/if} value="{$b.ws_size}">
             	</td>
             	<th class="paddingT15"></th> 
             	<td style="white-space: nowrap;">{if ($b.ws_new&&$b.gs_tid>0)||!$canedit}{else} {if $canedit}<a id="subdel_{$s.g_tid}_{$b.ws_tid}" item="{$b.ws_tid}" p="{$s.g_tid}" href="javasciprt:;">删除</a>{/if} {/if}
             	</td>
         </tr>
         {/foreach}
         {else}
         <tr>
				<th  class="paddingT15"><p class="left_th"><b style="color: #ff0000">*&nbsp;</b>品名: </p>
				</th>
				<td>
				<input type="text" placeholder="品名必填" name="normal[{$s.g_tid}][item][0][gs_name]" id="gs_name_{$s.g_tid}_0" item="0" p="{$s.g_tid}"
             	class="infoTableInput {if ($b.ws_new&&$b.gs_tid>0)||!$canedit}grayb" readonly="readonly"{/if} value="{$b.gs_name}">
             	<input type="hidden" name="normal[{$s.g_tid}][item][0][gs_tid]" value="0" >			
				</td>
				
             	<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>件数:  </th>
             	<td>
             	<input type="text" placeholder="件数必填" name="normal[{$s.g_tid}][item][0][gs_piece]" id="gs_piece_{$s.g_tid}_0" item="0"  p="{$s.g_tid}"
             	class="infoTableInput {if ($b.ws_new&&$b.gs_tid>0)||!$canedit}grayb" readonly="readonly"{/if} value="{$b.ws_piece}">
             	</td>
             	
             	<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>重量/吨:  </th>
             	<td> <input type="text" placeholder="重量必填" name="normal[{$s.g_tid}][item][0][gs_weight]" id="gs_weight_{$s.g_tid}_0" item="0" p="{$s.g_tid}"
             	class="infoTableInput {if ($b.ws_new&&$b.gs_tid>0)||!$canedit}grayb" readonly="readonly"{/if} value="{$b.ws_weight}">
             	</td>
             	
             	<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>尺码/立方米:  </th>
             	<td><input type="text" placeholder="尺码必填" name="normal[{$s.g_tid}][item][0][gs_size]" id="gs_size_{$s.g_tid}_0" item="0" p="{$s.g_tid}"
             	class="infoTableInput {if ($b.ws_new&&$b.gs_tid>0)||!$canedit}grayb" readonly="readonly"{/if} value="{$b.ws_size}">
             	</td>
             	<th class="paddingT15"></th> 
             	<td style="white-space: nowrap;">
             	</td>
         </tr>
         {/if}
         </table>
         <hr style="FILTER: alpha(opacity=100,finishopacity=0,style=1)" size="1" width="83%" color="#ccc">
		<table class="infoTable">
			<tr>
				<th  class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>货主:</th>
				<td>
					<input type="hidden" value="{$s.g_companytid}" name="normal[{$s.g_tid}][g_ownertid]" id="g_ownertid_{$s.g_tid}" item="{$s.g_tid}">
					<input type="text"  placeholder="货主必填" value="{$s.g_owner}" 	item="{$s.g_tid}" name="normal[{$s.g_tid}][g_owner]" id="hzshow_{$s.g_tid}"
					class="infoTableInput {if ($b.ws_new)||!$canedit}grayb" readonly="readonly"{else}"{/if}
					urldata="index.php?app=datarefer&act=gethz" urlval="index.php?app=datarefer&act=gethzinfo">
						{if $canedit&&!$s.new}<a href="javascript:void(0);" class="right_a" item="{$s.g_tid}" id="hzshowa_{$s.g_tid}" ><img src="templates/images/newadmin/serch.png" alt=""></a>
					<script>
						gethz("hzshow_{$s.g_tid}","g_owner_tel_{$s.g_tid}","g_ownertid_{$s.g_tid}");
					</script>{/if}
				</td>
             	<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>货主电话:  </th>
             	<td >
					<input type="text" placeholder="货主电话必填" value="{$s.g_owner_tel}" name="normal[{$s.g_tid}][g_owner_tel]" id="g_owner_tel_{$s.g_tid}"
					class="infoTableInput {if ($b.ws_new&&$b.gs_tid>0)||!$canedit}grayb" readonly="readonly"{else}"{/if} item="{$s.g_tid}">
             	</td>
				<th class="paddingT15">货物类型:</th>
				<td class="paddingT15 wordSpacing5">
					<select class="querySelect" name="normal[{$s.g_tid}][g_gtype]" >{html_options options=$goodstype selected=$s.g_gtype}</select>
				</td>
			</tr>
			<tr>
				<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>发货人:</th>
				<td class="paddingT15 wordSpacing5">
					<input placeholder="必填" class="infoTableInput {if ($b.ws_new&&$b.gs_tid>0)||!$canedit}grayb" readonly="readonly"{else}"{/if} type="text"
					name="normal[{$s.g_tid}][g_consignor]" id="g_consignor_{$s.g_tid}" value="{$s.g_consignor}"  item="{$s.g_tid}"/>
				</td>
				<th class="paddingT15" ><b style="color: #ff0000">*&nbsp;</b>发货人电话:</th>
				<td class="paddingT15 wordSpacing5">
					<input placeholder="必填" class="infoTableInput {if ($b.ws_new&&$b.gs_tid>0)||!$canedit}grayb" readonly="readonly"{else}"{/if} type="text"
					name="normal[{$s.g_tid}][g_consignor_tel]" id="g_consignor_tel_{$s.g_tid}"
					value="{$s.g_consignor_tel}"  item="{$s.g_tid}"/>
				</td>
				<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>装货地:  </th>
             	<td >
					<input type="text" placeholder="装货地必填" value="{$s.g_loading_place}" name="normal[{$s.g_tid}][g_loading_place]"
             	 id="g_loading_place_{$s.g_tid}" urldata="index.php?app=datarefer&act=getaddr" urlval="index.php?app=datarefer&act=getaddrinfo"
             	class="infoTableInput {if ($b.ws_new&&$b.gs_tid>0)||!$canedit}grayb" readonly="readonly"{else}"{/if} item="{$s.g_tid}" >
					<input type="hidden" value="{$s.g_unloading_lat}" name="normal[{$s.g_tid}][g_unloading_lat]" id="g_unloading_lat_{$s.g_tid}">
					<input type="hidden" value="{$s.g_unloading_lng}" name="normal[{$s.g_tid}][g_unloading_lng]" id="g_unloading_lng_{$s.g_tid}">
					{if $canedit&&!$s.new}
					<a href="javascript:void(0);" onclick="mapselect('#haul_{$s.g_tid}_h_address',{$s.g_tid},this,'1','1');" class="right_a">
						{if $s.g_unloading_lat>0&&$s.g_unloading_lng>0}<img src="templates/images/newadmin/map1.png" alt="" id="mapimg_{$s.g_tid}">{else}<img src="templates/images/newadmin/map.png" alt="" id="mapimg_{$s.g_tid}">{/if}</a>
					{/if}
						<script>
							addrrefer("g_loading_place_{$s.g_tid}","g_unloading_lng_{$s.g_tid}","g_unloading_lat_{$s.g_tid}","mapimg_{$s.g_tid}");
						</script>
             	</td>
				<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>装货时间:</th>
				<td class="paddingT15 wordSpacing5">
					<input placeholder="必填" class="infoTableInput {if ($b.ws_new&&$b.gs_tid>0)||!$canedit}grayb" readonly="readonly"{else}"{/if} type="text"
					name="normal[{$s.g_tid}][g_loading_date]" id="g_loading_date_{$s.g_tid}" value="{if $s.g_loading_date}{$s.g_loading_date|date:Y-m-d H:i}{else}{/if}" item="{$s.g_tid}"/>

					{if $canedit&&!$s.new}
					<script>
						$('#g_loading_date_{$s.g_tid}').datetimepicker({changeMonth: true,changeYear: true});
					</script><a href="javascript:void(0);"  onclick="cargotimeimg('1','1',{$s.g_tid});" class="right_a"><img src="templates/images/newadmin/rili.png" alt=""></a>{/if}
				</td>
         	</tr>
			<tr>
				<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>收货人:</th>
				<td class="paddingT15 wordSpacing5">
					<input placeholder="必填" class="infoTableInput {if ($b.ws_new&&$b.gs_tid>0)||!$canedit}grayb" readonly="readonly"{else}"{/if} type="text"
							 name="normal[{$s.g_tid}][g_consignee]" id="g_consignee_{$s.g_tid}" value="{$s.g_consignee}"  item="{$s.g_tid}"/>
				</td>
				<th class="paddingT15" ><b style="color: #ff0000">*&nbsp;</b>收货人电话:</th>
				<td class="paddingT15 wordSpacing5">
					<input placeholder="必填" class="infoTableInput {if ($b.ws_new&&$b.gs_tid>0)||!$canedit}grayb" readonly="readonly"{else}"{/if} type="text"
				 name="normal[{$s.g_tid}][g_consignee_tel]" id="g_consignee_tel_{$s.g_tid}" value="{$s.g_consignee_tel}"  item="{$s.g_tid}"/>
				</td>
				<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>卸货地:  </th>
				<td >
					<input type="text" placeholder="卸货地必填" value="{$s.g_unloading_place}" name="normal[{$s.g_tid}][g_unloading_place]"
												   id="g_unloading_place_{$s.g_tid}" urldata="index.php?app=datarefer&act=getaddr" urlval="index.php?app=datarefer&act=getaddrinfo"
												   class="infoTableInput {if ($b.ws_new&&$b.gs_tid>0)||!$canedit}grayb" readonly="readonly"{else}"{/if} item="{$s.g_tid}">
					<input type="hidden" value="{$s.g_loading_lat}" name="normal[{$s.g_tid}][g_loading_lat]" id="g_loading_lat_{$s.g_tid}">
					<input type="hidden" value="{$s.g_loading_lng}" name="normal[{$s.g_tid}][g_loading_lng]" id="g_loading_lng_{$s.g_tid}">
					{if $canedit&&!$s.new}
					<a href="javascript:void(0);" onclick="mapselect('#haul_{$s.g_tid}_h_address',{$s.g_tid},this,'2','1');" class="right_a">
						{if $s.g_unloading_lat>0&&$s.g_unloading_lng>0}<img src="templates/images/newadmin/map1.png" alt="" id="unmapimg_{$s.g_tid}">{else}<img src="templates/images/newadmin/map.png" alt="" id="unmapimg_{$s.g_tid}">{/if}</a>
					{/if}
					<script>
						addrrefer("g_unloading_place_{$s.g_tid}","g_loading_lng_{$s.g_tid}","g_loading_lat_{$s.g_tid}","unmapimg_{$s.g_tid}");
					</script>
				</td>
				<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>卸货时间:</th>
				<td class="paddingT15 wordSpacing5"><input placeholder="必填" class="infoTableInput {if ($b.ws_new&&$b.gs_tid>0)||!$canedit}grayb" readonly="readonly"{else}"{/if} type="text"
					name="normal[{$s.g_tid}][g_unloading_date]" id="g_unloading_date_{$s.g_tid}" value="{if $s.g_unloading_date}{$s.g_unloading_date|date:Y-m-d H:i}{else}{/if}" item="{$s.g_tid}"/>
					{if $canedit&&!$s.new}
					<script>
					$('#g_unloading_date_{$s.g_tid}').datetimepicker({changeMonth: true,changeYear: true});
					</script>
					<a href="javascript:void(0);" onclick="cargotimeimg('1','2',{$s.g_tid});" class="right_a"><img src="templates/images/newadmin/rili.png" alt=""></a>{/if}
				</td>
         	</tr>
			<tr>
				<th class="paddingT15">{$lang.wm_note}:</th>
				<td class="paddingT15 wordSpacing5" colspan="8">
					<textarea name="normal[{$s.g_tid}][g_note]" id="g_note_{$s.g_tid}" rows="3" style="width: 100%"
					class="{if ($b.ws_new)||!$canedit}grayb" readonly="readonly"{else}"{/if} item="{$s.g_tid}">{$s.g_note}</textarea>
				</td>
			</tr>
		</table>	
	{/foreach}
	</form>
	{if $canyy}
	{else}
		<table class="infoTable" style="padding: 0">
				<tr>
					<th></th>
				<td class="ptb20" colspan="7" style="text-align: left;padding-top: 0">{if $canedit}<input class="formbtn" type="button"
						name="Submit" value="{$lang.submit}" onclick="formsub()"/>{/if}</td>
				</tr>
		</table>
	{/if}
	<!-- {if $waybill.wm_tid}} -->
	<form method="post" enctype="multipart/form-data" id="paiche_form" action="index.php?app=waybillless&act=pcsave">
		<input type="hidden" value="{$waybill.wm_tid}" name="wm_tid">
		<input type="hidden" value="{$waybill.wm_carrier_id}" name="operator" id="operator">
		<div class="jui-cut-label fn-mt25">
	        <div class="jui-message-bar">派车信息
			<a style="float: right;margin-right: 20px" onclick="monitorinfo()">查看监控方案</a>
	        <p style="float: right">监控方案：<select {if !$canedit}disabled="disabled"{/if} class="querySelect" name="wm_zmmtid" id="wm_zmmtid"><option value="">请选择监控方案</option>{html_options options=$monitor selected=$waybill.wm_zmmtid}</select></p></div>
	    </div>
	    <table class="infoTable">
	    <tr>
				<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>{$lang.wm_carrier}:</th>
				<td class="paddingT15 wordSpacing5">
				<input
					class="infoTableInput" id="operatorshow" type="text"
					name="operatorshow" value="{$oper[$waybill.wm_carrier_id]}" urldata="index.php?app=datarefer&act=getcys" urlval="index.php?app=datarefer&act=getcysinfo"/>
					<a href="javascript:void(0);" class="right_a" id="operatorshowa"><img src="templates/images/newadmin/serch.png" alt=""></a>
					<script>
				refer("operatorshow","operator");
				</script>
					</td>
					
					<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>{$lang.wm_vhc_code}:
				</th>
				<td class="paddingT15 wordSpacing5" style="position: relative;"><input
					class="infoTableInput" id="wm_vhc_code" type="text"
					name="wm_vhc_code" value="{$waybill.wm_vhc_code}" />{if $canedit&&$waybill.wm_tid>0}<a href="javascript:void(0);" class="right_a"><img  id="cimg"  src="templates/images/newadmin/serch.png" alt=""></a>{/if}</td>
					
						<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>{$lang.wm_driver}:
				</th>
				<td class="paddingT15 wordSpacing5"><input
					class="infoTableInput" id="wm_driver" type="text"
					name="wm_driver" value="{$waybill.wm_driver}" /></td>
			
			<th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>{$lang.wm_driver_tel}:
				</th>
				<td class="paddingT15 wordSpacing5"><input
					class="infoTableInput" id="wm_driver_tel" type="text"
					name="wm_driver_tel" value="{$waybill.wm_driver_tel}" /></td>
				
			</tr>


			<tr>
<th class="paddingT15">发车要求:
				</th>
				<td class="paddingT15 wordSpacing5" colspan="3" >
					<input type="hidden" id="wm_requiredl_note_voice" name="wm_requiredl_note_voice" value="{$waybill.wm_requiredl_note_voice}"/>
					 {if $waybill.wm_requiredl_note_voice}
<audio controls="controls">

<source src="{$waybill.wm_requiredl_note_voice}" type="audio/ogg">

你的浏览器太老了，请更新否则没法听语音
</audio>
{/if}
					<textarea  name="wm_requiredl_note" id="wm_requiredl_note" rows="3" style="width: 100%">{$waybill.wm_requiredl_note}</textarea>
					
					</td>
			</tr>
			
			{if 1==0}
			{if $canedit}
			<tr>
			<th class="paddingT15">录音:
				</th>
				<td class="paddingT15 wordSpacing5" colspan="3" style="text-align: left">
					<input type="hidden" id="wm_requiredl_note_voice" name="wm_requiredl_note_voice" value="{$waybill.wm_requiredl_note_voice}"/>
					 {if $waybill.wm_requiredl_note_voice}
<audio controls="controls">

<source src="{$waybill.wm_requiredl_note_voice}" type="audio/ogg">

你的浏览器太老了，请更新否则没法听语音
</audio>
{/if}
					{if $waybill.wm_stauts=='新建'||$waybill.wm_stauts=='已接单'}
<input type="button" onclick="start()" value="录音" id="startbtn"/>
<input type="button" onclick="stop()" value="停止"  id="stopbtn" style="display: none"/>
{/if}
					
					</td>
			
			</tr>
			{/if}
			{/if}
			<tr>
			
				<th class="paddingT15">{$lang.wm_dispatch_person}:
				</th>
				<td class="paddingT15 wordSpacing5"><input
					class="infoTableInput" id="wm_dispatch_person" type="text" readonly="readonly"
					name="wm_dispatch_person" value="{$waybill.wm_dispatch_person}" style="border: 0;" />
				</td>
				<th class="paddingT15">{$lang.wm_dispatch_person_tel}:
				</th>
				<td class="paddingT15 wordSpacing5"><input
					class="infoTableInput" id="wm_dispatch_person_tel" type="text" readonly="readonly"
					name="wm_dispatch_person_tel"
					value="{$waybill.wm_dispatch_person_tel}" style="border: 0;" /></td>
					
					<th class="paddingT15">{$lang.wm_dispatch_date}:
				</th>
				<td class="paddingT15 wordSpacing5"><input
					class="infoTableInput" id="wm_dispatch_date" type="text" readonly="readonly"
					name="wm_dispatch_date" value="{$waybill.wm_dispatch_date|date:Y-m-d H:i}" style="border: 0;" /> </td>
				
			</tr>
			{if $canedit}
			<tr>
				<th></th>
			<td class="ptb20" colspan="7" style="text-align: left"><input class="formbtn" type="submit"
					name="Submit" value="保存"/>
					<a class="formbtn" type="button" href="index.php?app=waybillless&act=paichedone&wm_tid={$waybill.wm_tid}&wm_user={$waybill.wm_user}"
					name="Submit" >发车</a>
					</td>
					

			</tr>	{/if}

</table>
	</form>
	<!-- {if $waybill.wm_tid}} -->
	<form method="post" enctype="multipart/form-data" action="index.php?app=waybillless&act=hauledit">
<input type="hidden" value="{$waybill.wm_tid}" name="wm_tid">
<div class="jui-cut-label fn-mt25">
	        <div class="jui-message-bar">运程信息
	        <p style="float: right">{if $canedit}运程方案：<select {if !$canedit}disabled="disabled"{/if} class="querySelect" id="yuncheng">
	        <option value="">请选择运程方案</option>{html_options options=$hauldefine}</select>{/if}</p>
				{if $canedit}
				<a style="float: right;margin-right: 20px" onclick="addhaul();">添加运程</a>
				{/if}
			</div>
	    </div>
	  <style>
	  .tt th{width: 70px}
	  </style>
		<div id="div_haul">
	    {foreach from=$haullist item=h}
	    <div class="haul_div">
	    <table class="infoTable tt" style="width:98%;padding: 10px 0 0 0">
	    <tr>
				<th class="paddingT15">运程:</th>
				<td class="paddingT15 wordSpacing5">
				<input
					class="infoTableInput" type="text"
					name="haul[{$h.h_tid}][h_name]" value="{$h.h_name}" />
					
					<input type="hidden" name="haul[{$h.h_tid}][h_tid]" value="{$h.h_tid}" />
					</td>
					
					<th class="paddingT15">联系人:
				</th>
				<td class="paddingT15 wordSpacing5"><input
					class="infoTableInput" type="text"
					name="haul[{$h.h_tid}][h_linkman]" value="{$h.h_linkman}"  /></td>
					
						<th class="paddingT15">电话:
				</th>
				<td class="paddingT15 wordSpacing5"><input
					class="infoTableInput" type="text"
					name="haul[{$h.h_tid}][h_linkman_tel]" value="{$h.h_linkman_tel}" /></td>
			
				<th class="paddingT15">确认类型:
				</th>
				<td class="paddingT15 wordSpacing5">
				<select class="querySelect" name="haul[{$h.h_tid}][h_type]" id="h_type_{$h.h_tid}">{html_options options=$typelist selected=$h.h_type}</select></td>
				<th class="paddingT15 range" style="display:{if $h.h_type==1}none{/if}">运程范围:</th>
				<td class="paddingT15 wordSpacing5 range" style="display:{if $h.h_type==1}none{/if}">
					<input class="infoTableInput" placeholder="请填写数字" type="text" name="haul[{$h.h_tid}][h_range]"  value="{$h.h_range}" />
				</td>
			</tr>


			<tr>
<th class="paddingT15">状态:</th>
				<td class="paddingT15 wordSpacing5" style="font-size: 14px">
				{if $h.h_finished==0}未开始{/if}{if $h.h_finished==-1}异常{/if}{if $h.h_finished==2}完成{/if}
					{if $h.h_finished_date}{$h.h_finished_date|date:Y-m-d H:i}{/if}
					</td>
					<th class="paddingT15">时间:</th>
				<td class="paddingT15 wordSpacing5" >
				<input
					class="infoTableInput" type="text"
					name="haul[{$h.h_tid}][h_required_service_date]" 
					value="{if $h.h_required_service_date}{$h.h_required_service_date|date:Y-m-d H:i}{else}-{/if}" 
					id="h_required_service_date_{$h.h_tid}" />
					{if $canedit}
					 <script>
					$('#h_required_service_date_{$h.h_tid}').datetimepicker({changeMonth: true,changeYear: true});
					</script>
					{/if}<a href="javascript:void(0);"  onclick="cargotimeimg('3','1',{$h.h_tid});" class="right_a"><img id="h_required_service_date_img_{$h.h_tid}" src="templates/images/newadmin/rili.png" alt=""></a>
					</td>
			
				

<th class="paddingT15">要求:</th>
				<td class="paddingT15 wordSpacing5" >
				<input
					class="infoTableInput" type="text"
					name="haul[{$h.h_tid}][h_note]" value="{$h.h_note}"  />
					</td>
					<th class="paddingT15">地址:</th>
				<td class="paddingT15 wordSpacing5">
				<input type="hidden" value="{$h.h_lat}" name="haul[{$h.h_tid}][h_lat]" id="h_lat_{$h.h_tid}">
				<input type="hidden" value="{$h.h_lng}" name="haul[{$h.h_tid}][h_lng]" id="h_lng_{$h.h_tid}">
				<input
					class="infoTableInput" type="text"
					name="haul[{$h.h_tid}][h_address]" value="{$h.h_address}" id="haul_{$h.h_tid}_h_address"  />
					<a href="javascript:void(0);" onclick="mapselect('#haul_{$h.h_tid}_h_address',{$h.h_tid},this,'3','3');" class="right_a">
					{if $h.h_lat>0&&$h.h_lng>0}<img src="templates/images/newadmin/map1.png" alt="" id="hmapimg_{$h.h_tid}">{else}<img src="templates/images/newadmin/map.png" alt="" id="hmapimg_{$h.h_tid}">{/if}</a>
					</td>
			</tr>
		</table>
		<div style="padding: 0 0 0 50px" class="itemdiv">
			{if $canedit && $h.h_finished==0}
			<a class="addhandle2 btn_add" var="{$h.h_tid}" dig="{$h.item|modifier:getcount}" >采集信息</a>
			{/if}
		{foreach from=$h.item item=i name=it}
		<div style="padding: 2px 0;">
		<input type="hidden" name="haul[{$h.h_tid}][item][{$i.hc_tid}][hc_tid]" value="{$i.hc_tid}" />
		<span style="background: #ccccce;display: block;padding: 5px 8px;float: left">{$smarty.foreach.it.iteration}</span> 
		{if $h.h_finished<2}
		<p style="float: left;margin: 0 40px">操作：<select class="querySelect" name="haul[{$h.h_tid}][item][{$i.hc_tid}][h_collect_type]" >{html_options options=$ctype selected=$i.h_collect_type}</select></p>
		<p style="float: left;margin: 0 40px">说明：<input
					class="infoTableInput" type="text"
					name="haul[{$h.h_tid}][item][{$i.hc_tid}][h_collect_des]" value="{$i.h_collect_des}" style="float: none"/></p>
		{else}
		<p style="float: left;margin: 0 40px">

		{if $i.h_collect_type==0}扫描{/if}
		{if $i.h_collect_type==1}输入{/if}
		{if $i.h_collect_type==2}数字输入{/if}
		{if $i.h_collect_type==3}拍照{/if}
		{if $i.h_collect_type==4}录音{/if}
		</p>
		<p style="float: left;margin: 0 40px">{$i.h_collect_des}</p>
		{if $i.h_collect_type<3}
		<p style="float: left;margin: 0 40px">{$i.h_collect_val}</p>
		{/if}
		{if $i.h_collect_type==3&&$i.ar!=null}
		{foreach from=$i.ar item=a}
		<a href="{$site_url}/{$a}" target="_blank"><img src="{$site_url}/{$a}" style="height:100px;width:100px"/></a>
		{/foreach}
		{/if}
		
		{if $i.h_collect_type==4&&$i.ar!=null}
		{foreach from=$i.ar item=a}
		<audio controls="controls">

		<source src="{$site_url}/{$a}" type="audio/ogg">
		
		你的浏览器太老了，请更新否则没法听语音
		</audio>
		{/foreach}
		{/if}
		{/if}
		<div style="clear: both"></div>
		</div>
		{/foreach}
		<div style="clear: both"></div>
		</div>
		</div>
		{/foreach}
		</div>
		{if $canedit&&$haullist}
		<table class="infoTable" style="padding: 0">
			<tr>
				<th style="padding: 5px"><input class="formbtn" type="Submit"
					name="Submit" value="{$lang.submit}" style="width:150px;margin-left: 20px"/></th>
			<td class="ptb20" colspan="7" style="text-align: left"></td>

			</tr></table>
			{/if}
	</form>
	{/if}
{else}

<!-- 	{/if} -->
<style>
.left{float: left;padding: 20px}
.mapdiv{height: 300px;width: 300px}
.fontdiv{height: 30px;line-height: 30px}
</style>

<!-- {if $waybill.wm_tid}} -->
	    
<div class="jui-cut-label fn-mt25" style="margin-top: 20px">
	        <div class="jui-message-bar">异常信息</div>
	    </div>
{foreach from=$exception item=e}
 <div style="border-left: 4px solid #76b5ea;border-top: 1px solid #d3dae0;border-bottom: 1px solid #d3dae0;border-right: 1px solid #d3dae0;margin: 10px 10px 20px 20px;">
	    <form method="post" enctype="multipart/form-data" id="exception_form" action="index.php?app=waybillless&act=exceptiondone">
	    <input type="hidden" value="{$e.e_tid}" name="exp[{$e.e_tid}][e_tid]">
	    <input type="hidden" value="{$e.e_w_tid}" name="wm_tid">
	    <div class="left">
	    <div class="fontdiv">类型：{if $e.e_type}{$e.e_type} /{/if} {$e.e_content}</div>
	    <div class="fontdiv">时间：{$e.e_op_date|date:Y-m-d H:i}</div>
	    <div class="fontdiv">位置：{$e.e_address}</div>
	    <div id="allmap_{$e.e_tid}" class="mapdiv"></div>
	<script>
	var map = new BMap.Map("allmap_{$e.e_tid}");
    map.centerAndZoom(new BMap.Point({$e.e_lng}, {$e.e_lat}), 15);
    map.enableScrollWheelZoom();

    var point = new BMap.Point({$e.e_lng}, {$e.e_lat});    
    var marker = new BMap.Marker(point);        // 创建标注    
    map.addOverlay(marker);
	</script>
	<div style="clear: both"></div>
	    </div>
	    <div class="left">
	    {if $e.e_text_note}
	     <div class="fontdiv">文字：{$e.e_text_note}</div>
	     {/if}
	 {if $e.e_pic}
	    <div class="">图片：
	    
	    {foreach from=$e.e_pic item=p}
	    <a href="{$site_url}/{$p.ea_content}" target="_blank" style=""><img src="{$site_url}/{$p.ea_content}" style="height:100px;width:100px;vertical-align: top;"/></a>
		{/foreach}	   
	    <div style="clear: both"></div>
	    </div>
	    {/if}
	       {if $e.e_voice}
	    {foreach from=$e.e_voice item=v}
	    <div class="fontdiv" style="line-height: 50px;height: 50px;margin-top: 20px">录音：
	    <audio controls="controls" style="vertical-align: top">

<source src="{$site_url}/{$v.ea_content}" type="audio/ogg">

你的浏览器太老了，请更新否则没法听语音
</audio>
	    {/foreach}	   
	    </div>
	    {/if}
	    <div class="fontdiv" style="float: left;width: 168px">状态：{$e.e_staus}</div>
	    <div class="fontdiv" style="float: left;width: 300px">处理人：<input type="text" name="exp[{$e.e_tid}][e_handle_person]" value="{$e.e_handle_person}" style="height: 23px;
   
    padding: 0px 5px;
    border: 1px solid #ccc;
    outline: 0;
    font-size: 14px;
    line-height: 19px;"/></div>
	    <div style="clear: both"></div>
	     <div class="fontdiv" style="position: relative;">时间：<input type="text" id="e_handle_date_{$e.e_tid}" name="exp[{$e.e_tid}][e_handle_date]" value="{if $e.e_handle_date}{$e.e_handle_date|date:Y-m-d H:i}{else}-{/if}" style="height: 23px;
   
    padding: 0px 5px;
    border: 1px solid #ccc;
    outline: 0;
    font-size: 14px;
    line-height: 19px;width: 350px"/><a href="javascript:void(0);" class="right_a" style="right: 70px;
    top: 2px;"><img src="templates/images/newadmin/rili.png" alt=""></a></div>
    <script>
					$('#e_handle_date_{$e.e_tid}').datetimepicker({changeMonth: true,changeYear: true});
	</script>
	      <div class="fontdiv">备注：<textarea style=" width: 350px;height: 120px;
   
    padding: 0px 5px;
    border: 1px solid #ccc;
    outline: 0;
    font-size: 14px;
    line-height: 19px;" name="exp[{$e.e_tid}][e_handle_note]">{$e.e_handle_note}</textarea></div>
	    </div>
	    	<div style="clear: both"></div>
	    	{if $e.e_staus!='已处理'}
		<table class="infoTable" style="padding: 0">
			<tr>
				<th style="padding: 5px"><input class="formbtn" type="Submit"
					name="Submit" value="{$lang.submit}" style="width:150px;margin-left: 20px"/></th>
			<td class="ptb20" colspan="7" style="text-align: left"></td>

			</tr></table>
			{/if}
	</form>
	</div>
{/foreach}
	
<!-- 	{/if} -->
</div>
	
{include file="footer.html"}